using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using TT.Module.sysLogin;
using SfcorpDLL.ety;
using SQLHelper;

namespace SfcorpDLL.dao
{
    public class daoCntrCorp
    {
        etyBaeSystemParamter basSysParam;

        public daoCntrCorp(etyBaeSystemParamter ieyBasClassDeclare)
        {
            basSysParam = ieyBasClassDeclare;
        }

        public DataTable GetCntrCorp(etyCntrCorp inEty)
        { 
            string sql = "select * from v_c_cntr_corp  ";
            return basSysParam.SqlHelp.ExecuteReader(sql, inEty);
        }

        public daoResult Insert_CntrCorp(etyCntrCorp inEty)
        {
            string sql = "insert into C_CNTR_CORP(CNTR_CORP_COD,CNTR_CORP_NAM,ENABLE_FLAG,REC_NAM,REC_TIM,SEQ_NO,REMARKS) "
                + "values(:CNTR_CORP_COD,:CNTR_CORP_NAM,:ENABLE_FLAG,:REC_NAM,SYSDATE,nvl(:SEQ_NO,(select nvl(max(SEQ_NO),0)+1 from C_CLIENT)),:REMARKS)";
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

        public daoResult Update_CntrCorp(etyCntrCorp inEty)
        {
            string sql = "update C_CNTR_CORP set CNTR_CORP_COD=:CNTR_CORP_COD,CNTR_CORP_NAM=:CNTR_CORP_NAM,ENABLE_FLAG=:ENABLE_FLAG,SEQ_NO=:SEQ_NO,REMARKS=:REMARKS where ROWID =:ROW_ID ";
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

        public daoResult Delete_CntrCorp(etyCntrCorp inEty)
        {
            string sql = "delete C_CNTR_CORP where  ROWID =:ROW_ID ";
            return basSysParam.SqlHelp.ExecuteTrans(sql, inEty);
        }

    }
}